package com.gjy.service;

import com.gjy.dao.StudentMapper;
import com.gjy.domain.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {

    @Autowired
    StudentMapper studentMapper;

    public void add(Student student){
        studentMapper.insertSelective(student);
    }



    public List<Student> findAll(){
        List<Student> list = studentMapper.selectByExample(null);
        return list;
    }

    public Student getOne(Integer id) {
       Student student = studentMapper.selectByPrimaryKey(id);
       return student;
    }

    public void update(Student student) {
        studentMapper.updateByPrimaryKeySelective(student);
    }

    public void deleteById(Integer id) {
        studentMapper.deleteByPrimaryKey(id);
    }
}
